package com.thinkcar.test.boot.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.thinkcar.core.exception.Result;
import com.thinkcar.test.boot.entity.User;
import com.thinkcar.test.boot.reqparam.GetUsersPageReq;
import com.thinkcar.test.boot.service.UserService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: jiangyong
 * @date: 2025/10/19
 * @description: UserController
 */
@RestController
@RequestMapping("/user")
@Tag(name = "user测试")
public class UserController {

    @Autowired
    private UserService userService;

    @PostMapping("getUsersPage")
    @Operation(summary = "分页查询")
    public Result<Page<User>> getUsersPage(@RequestBody GetUsersPageReq requestParam) {
        Page<User> user = userService.getUsersPage(requestParam);
        return Result.success(user);
    }
}
